﻿using Newtonsoft.Json.Linq;


namespace android_charge
{
    public partial class Amazon_config : Form
    {

        Amazon sideTool;
        public Amazon_config(Amazon sideTool)
        {
            InitializeComponent();
            this.Text = sideTool.devices_id;
            this.sideTool = sideTool;
            init();
        }

        public void init()
        {
            server.Text = sideTool.server;
            port.Text = sideTool.port;
            region.Text = sideTool.region;
            link.Text = sideTool.link;
        }

        private void Amazon_config_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (sideTool == null)
            {
                return;
            }
            if (String.IsNullOrEmpty(server.Text))
            {
                sideTool.server = server.Text;
            }
            if (String.IsNullOrEmpty(port.Text))
            {
                sideTool.port = port.Text;

            }

            if (String.IsNullOrEmpty(region.Text))
            {
                sideTool.region = region.Text;  
            }

            if (String.IsNullOrEmpty(link.Text))
            {
                sideTool.link = link.Text;
            }

        }

        private void label5_Click(object sender, EventArgs e)
        {
            sideTool.clash_config();
            init();
        }
    }
}
